// ============================================================ //
// ============================================================ //
//
// @Group       : QiXin Supply Chain Team
// @Author      : ZhiQiang Cheng
// @Date        : 2024-07-12
// @Description : Redis常量
//
// ============================================================ //
// ============================================================ //

package constants

import (
	"strings"
)

type RedisKey string

var (
	RedisKeyRoomInfoChannel      RedisKey = "room:info:channel"       // 房间信息频道
	RedisKeyRoomInfo             RedisKey = "room:info"               // 房间信息
	RedisKeyRoomNoticeChannel    RedisKey = "room:notice:channel"     // 房间通知频道
	RedisKeyRoomNotice           RedisKey = "room:notice"             // 房间通知
	RedisKeyRoomQueueChannel     RedisKey = "room:queue:channel"      // 房间队列频道
	RedisKeyRoomQueue            RedisKey = "room:queue"              // 房间队列
	RedisKeyRoomVoteChannel      RedisKey = "room:vote:channel"       // 房间投票频道
	RedisKeyRoomVote             RedisKey = "room:vote"               // 房间投票
	RedisKeyRoomUserPrizeChannel RedisKey = "room:user-prize:channel" // 房间用户奖品频道
	RedisKeyRoomUserPrize        RedisKey = "room:user-prize"         // 房间用户奖品
	RedisKeyRoomActiveUser       RedisKey = "room:active-user"        // 房间活跃用户
	RedisKeyUserFavoriteChannel  RedisKey = "user:favorite:channel"   // 用户收藏频道
	RedisKeyUserFavorite         RedisKey = "user:favorite"           // 用户收藏
)

func (rk *RedisKey) BuildKey(keys ...string) string {
	if len(keys) == 0 {
		return rk.String()
	}
	return rk.String() + ":" + strings.Join(keys, ":")
}

func (rk *RedisKey) String() string {
	return "wooha-cache-hub:" + string(*rk)
}
